<template>
  <div v-loading="loading" class="license-info-main">
    <el-form v-if="form" ref="form" size="small" label-width="150px">
      <el-form-item label="营业执照号：">
        {{ form.businessInfo.businessLicenseNum||'-' }}
      </el-form-item>
      <el-form-item label="组织机构代码证号：">
        <div>{{ form.businessInfo.organizationCode||'-' }}</div>
        <div>
          <el-image
            style="width: 300px; height: 200px;margin-right: 10px"
            :src="fileBaseUrl+form.businessInfo.businessLicenseImg"
            fit="fill"
          >
            <div slot="error" class=" el-image__error flex-y-center-center" style="width: 100%; height: 100%;">
              <div>{{ form.businessInfo.businessLicenseImg?'加载失败':'营业执照未上传' }}</div>
            </div>
          </el-image>
          <el-image
            style="width: 300px; height: 200px"
            :src="fileBaseUrl+form.businessInfo.organizationCodeImg"
            fit="fill"
          >
            <div slot="error" class=" el-image__error flex-y-center-center" style="width: 100%; height: 100%;">
              <div>{{ form.businessInfo.organizationCodeImg?'加载失败':'组织机构代码证未上传' }}</div>
            </div>
          </el-image>
        </div>
      </el-form-item>
      <el-form-item label="法人姓名：">
        {{ form.businessInfo.legalPerson||'-' }}
      </el-form-item>
      <el-form-item label="法人手机：">
        {{ form.businessInfo.legalMobilePhone||'-' }}
      </el-form-item>
      <el-form-item label="法人身份证号：">
        <div>{{ form.businessInfo.legalIdentityCard||'-' }}</div>
        <div>
          <el-image
            style="width: 300px; height: 200px;margin-right: 10px"
            :src="fileBaseUrl+form.businessInfo.organizationCodeImg"
            fit="fill"
          >
            <div slot="error" class=" el-image__error flex-y-center-center" style="width: 100%; height: 100%;">
              <div>{{ form.businessInfo.organizationCodeImg?'加载失败':'身份证未上传' }}</div>
            </div>
          </el-image>
          <el-image
            style="width: 300px; height: 200px"
            :src="fileBaseUrl+form.businessInfo.legalIdentityCardImg2"
            fit="fill"
          >
            <div slot="error" class=" el-image__error flex-y-center-center" style="width: 100%; height: 100%;">
              <div>{{ form.businessInfo.legalIdentityCardImg2?'加载失败':'身份证未上传' }}</div>
            </div>
          </el-image>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { mchDetail } from '@/api/mch/index'

export default {
  data() {
    return {
      // 配置
      // 状态
      loading: false,
      // 数据
      form: null
    }
  },
  computed: {
    ...mapGetters(['fileBaseUrl'])
  },
  watch: {},
  beforeCreate() {
  },
  created() {
  },
  beforeMount() {
  },
  mounted() {
    this.fetchData()
  },
  beforeUpdate() {
  },
  update() {
  },
  activated() {
  },
  deactivated() {
  },
  beforeDestroy() {
  },
  destroyed() {
  },
  methods: {
    /**
     * 数据组
     */
    // 获取数据
    fetchData() {
      this.loading = true
      const params = {
        businessId: this.$route.query.mchId
      }
      mchDetail({ params }).then(res => {
        this.form = res.data
      }).finally(() => {
        this.loading = false
      })
    }
    /**
     * 按钮组
     */
    /**
     * 状态组
     */
    /**
     * 方法组
     */
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.license-info-main {
  .box-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
  }
}
</style>
